﻿using System.Collections.Generic;

namespace Camstar.Utils.csv.Data
{
    /// <summary>
    /// Interface for classes that can generate unique, clean names.
    /// </summary>
    public interface INameSpace
    {
        /// <summary>
        /// Gets a collection of names in the name space (the order of the collection is undefined).
        /// </summary>
        ICollection<string> Names { get; }

        /// <summary>
        /// Clean a name so that is safe for usage.
        /// </summary>
        /// <param name="name">The name to be cleaned.</param>
        /// <returns>The safe name.</returns>
        string CleanName(
            string name);

        /// <summary>
        /// Gets a value indicating if the specified name is in use.
        /// </summary>
        /// <param name="name">The name to be tested.</param>
        /// <returns>True, if the name exists in the namespace; otherwise, false.</returns>
        bool ContainsName(
            string name);

        /// <summary>
        /// Create a unique name.
        /// </summary>
        /// <returns>A unique name.</returns>
        string CreateName();

        /// <summary>
        /// Create a unique name.
        /// </summary>
        /// <param name="baseName">The base name used during creation (or null).</param>
        /// <returns>A unique name.</returns>
        string CreateName(
            string baseName);
    }
}